//
//  YGPWDTableViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/17.
//

#import "YGCodeTableViewCell.h"

@interface YGCodeTableViewCell ()
@property(nonatomic, strong)UITextField *codeField;   //验证码

@end
@implementation YGCodeTableViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{

    [self addContentView:self.codeField];
}


- (void)initContraints{
    [self.codeField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(self.contentSuperView.mas_height);
        make.width.mas_equalTo(200);
       
    }];
    
}

- (void)setPlaceHolder:(NSString *)placeholder{
    self.codeField.placeholder=placeholder;
}

- (void)unInput{
    self.codeField.enabled = NO;
    self.codeField.userInteractionEnabled = NO;
}
- (void)textFieldDidChange:(UITextField *)theTextField{
    if (self.CallBack) {
        self.CallBack(theTextField.text, self.tag);
    }
}

- (void)configureData:(YGRegisterConfigureModel *)infoModel{
    if (self.tag == 106) {
        self.codeField.text = infoModel.hospital;
    }else if (self.tag == 107){
        self.codeField.text = infoModel.department;
    }else if (self.tag == 108){
        self.codeField.text = infoModel.attending_dr;
    }
}
- (UITextField *)codeField{
    if (!_codeField) {
        _codeField =[[UITextField alloc] init];
        _codeField.font= [UIFont systemFontOfSize:14];
        _codeField.layer.borderWidth=0;
        _codeField.textAlignment= NSTextAlignmentLeft;
        _codeField.delegate = self;
        [_codeField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];

    }
    return _codeField;
}






@end
